package it.heima.xmy.Demo01;

import java.io.*;

public class Practise05 {
    static fileFilter fileFilter = new fileFilter();

    public static void main(String[] args) throws IOException {
        File file = new File("F:\\img1");
        File file1 = new File("F:\\img2");
        file1.mkdirs();
        //调用接口方法查询jpg文件
        for (File listFile : file.listFiles()) {
            if (fileFilter.accept(listFile)) {
                InputStream is = new FileInputStream(listFile);
                OutputStream os = new FileOutputStream(new File(file1, listFile.getName()));
                int a = -1;
                while ((a = is.read()) != -1) {
                    os.write(a);
                }
                is.close();
                os.close();
            }
        }
    }
}
